#ifndef _SHIP_H_
#define _SHIP_H_

#include "Entity.h"
#include "Base.h"
#include "feature\SuperShield.h"

namespace model
{
class SuperShield;
class Ship : public Entity
{
public:
	Ship(void);
	Ship(int id, const std::string& image, const Point &position, int rotationVelocity,
		 int maxVelocity, int propulsion, int friction, int bulletTimeOut);
	virtual ~Ship(void);
	void initializeFeatures(void);
	void setImagePath(string path) { this->imagePath = path;}
	string getImagePath(void) { return imagePath;}
	string getAcceleratedImagePath(void);
	void setRotationVelocity(int velocity) { this->rotationVelocity = velocity;}
	int getRotationVelocity(void) { return rotationVelocity;}
	void setMaximumVelocity(int velocity) { this->maximumVelocity = velocity;}
	int getMaximumVelocity(void) { return maximumVelocity;}
	void setPropulsion(int propulsion) { this->propulsion = propulsion;}
	int getPropulsion(void) { return propulsion;}
	void setFriction(int friction) { this->friction = friction;}
	int getFriction(void) { return friction;}
	void setBulletTimeout(int timeout) { this->bulletTimeout = timeout;}
	int getBulletTimeout(void) { return bulletTimeout;}
	void rotateLeft(void);
	void rotateRight(void);
	void stopRotation(void) { this->currentRotationVelocity = 0;}
	void acelerate(void);
	bool isAcelerated(void) { return (this->aceleration > 0);}
	void stopAceleration(void) { this->aceleration = 0;}
	bool isRotatingLeft(void) { return currentRotationVelocity > 0;}
	bool isRotatingRight(void) { return currentRotationVelocity < 0;}
	virtual void updatePositions(double currentTime);
	Polygon* getPolygon(void);
	void setBase(Base* base) { this->base = base;}
	Base* getBase(void) { return this->base;}

	// Life
	void setLife(int life) { this->life = life;}
	int getLife(void) { return life;}
	void decreaseLife(int power);
	
	// Number of lifes
	void setNumberOfLifes(int lifes) { this->numberOfLifes = lifes;}
	int getNumberOfLifes(void) { return numberOfLifes;}
	void decreaseNumberOfLifes(void);

	// Missiles
	void setMissiles(int missiles) { this->missiles = missiles;}
	int getMissiles(void) { return missiles;}
	void decreaseMissilesChargeCount(void) { missiles--;}

	// Super shield
	SuperShield* getSuperShield(void);

	// Laser
	void enableLaser(void) { this->isLaser = true;}
	void desableLaser(void) { this->isLaser = false;}
	bool isLaserActivated(void) { return isLaser;}

	// Neutron bomb
	void enableNeutronBomb(void) { this->isNeutronBomb = true;}
	void disableNeutronBomb(void) { this->isNeutronBomb = false;}

	// Mines
	void setMines(int);

	// Bomb
	void enableBomb(void) { this->isBomb = true;}
	void disableBomb(void) { this->isBomb = false;}
	bool isBombEnabled(void) { return this->isBomb;}

	// Guided missile
	void enableGuidedMissil(void) { this->isGuidedMissil = true;}
	void disableGuidedMissil(void) { this->isGuidedMissil = false;}

	// Shield
	SuperShield* getShield(void);
	void setShieldEnergy(int);
	int getShieldEnergy(void);
	void reduceShieldEnery(int power);

	// Gravitation shield
	void enableGravitationShield(void) { this->isGravitationShield = true;};
	void disableGravitationShield(void) { this->isGravitationShield = false;};
	
	// Gravitation weapon
	void enableGravitationWeapon(void);
	void disableGravitationWeapon(void);
protected:
	void updateFeaturePosition(void);
private:
	string imagePath;
	int rotationVelocity;
	int maximumVelocity;
	int propulsion;
	int friction;
	int bulletTimeout;
	int aceleration;
	int currentRotationVelocity;
	int life, numberOfLifes;
	int missiles;
	SuperShield* superShield;
	bool isLaser;
	bool isNeutronBomb;
	int minesChargeCount;
	bool isBomb;
	bool isGuidedMissil;
	SuperShield* shield;
	int shieldEnergy;
	bool isGravitationShield;
	bool isGravitationWeapon;
	Base* base;
};
};

#endif
